﻿@model WebApp.ServerModelView
@section css{
	<link href="@Url.Content("~/Content/css/style-server.css")" rel="stylesheet">
 }
 <style type="text/css">

	div.span4{
        height:2em;
		max-height:5em;
		}
    .contentSlide{
        margin-bottom:0.3em;
        /*visibility:hidden;*/
    }
 </style>

@{
	ViewBag.Title = "Liste des tables";
	Layout = "~/Views/Shared/_Layout_home.cshtml";
}
	<a href="/Serveur/Tables"><h2>Tables</h2></a>     
	

	@if (Model == null)
	{
			<div class="span4" >Aucune table ne vous est attribué.</div>     
	}

	@{
		foreach (var item in Model.Tables)
		{                             
			if (item != null)
			{
				if (item.Commande == null)
				{
					<p>Libre</p>
				}
				else
				{
					var num = item.Numero;
					var etat = "";
					var classe = "";
					switch (@item.Commande.EtatCommande.ToString())
					{
						case("Entrée"):
							etat = "Entrée en cours";
							classe = "ok";
							break;                                
						case("PlatPrincipal"):
							etat = "Repas en cours";
							classe = "ok";
							break;
						case("Dessert"):
							etat = "Dessert en cours";
							classe = "ok";
							break;
						case("Autres"):
							etat = "Disponible ?";
							classe = "autre";
							break;
						case("EnAttenteCuisine"):
							etat = "En att. Cuisine";
							classe = "ok";
							break; 
						case("PlatPret"):
							etat = "Plat en cuisine";
							classe = "ready";
							break;                                                                                                                                  
						default:
							etat = "Libre";
							classe = "autre";
							break;
                    }
						<div class="span4 notif" >
							<div class="number">N° @num  - </div> 
							<div class="status @classe">@etat</div>                  
							<div class="img">
							   <a href="" class="buttonSlide">
								<img class="check" src="@Url.Content("~/Content/img/server/plus.png")" alt="" />   
								</a>
							</div><br /><br />
						   <div class="contentSlide">
							Temps écoulé : 0:52min<br />
							Capacité : @item.Capacite couverts
							</div>                                  
						</div>                        
						
					
			}
		}
	
	}
			<a href="/Serveur/Notifications"><h4>Notifications</h4></a>    
}
<script>
    $(document).ready(
function () {
    //Slider	 
    $(".contentSlide").each(
		 function (index) {
		     
		     var $content = $(this);
		     var $button = $("a.buttonSlide")[index];

		     $($button).toggle(function () {
                    $($content).animate({ height: 'hide', opacity: 'hide' }, 'slow',
                        function () {
                            $($content).parent("div.span4").css("height", "2em");
                        });


                    },
                    function () {
                     $($content).parent("div.span4").css("height", "5em");
                    $($content).animate({ height: 'show', opacity: 'show' }, 'slow',
                    function () {
                        
                    });
				 });


            $($content).hide();
		     $($button).css("cursor", "pointer");
		     
		 });

});
</script>